<% layout('/layout/default.html', {title: '运行中的流程', libs: ['dataGrid']}){ %>
<div class="main-content">
  <div class="box box-main">
    <div class="box-header">
      <div class="box-title">
        <i class="fa fa-cubes"></i> 运行中的流程
      </div>
      <div class="box-tools pull-right">
        <a class="btn btn-default" href="#" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
      </div>
    </div>
    <div class="box-body">
      <form action="${ctx}/act/process/runningData" class="form-inline hide" id="searchForm" method="post">

        <div class="form-group">
          <label class="control-label">流程实例ID：</label>
          <div class="control-inline">
            <input class="form-control" maxlength="64" name="procInsId"/>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label">流程定义Key：</label>
          <div class="control-inline">
            <input class="form-control" maxlength="64" name="procDefKey"/>
          </div>
        </div>
        <div class="form-group">
          <button class="btn btn-primary btn-sm" type="submit">查询</button>
          <button class="btn btn-default btn-sm" type="reset">重置</button>
        </div>
      </form>
      <table id="dataGrid"></table>
    </div>
  </div>
</div>
<% } %>
<script>
    //初始化DataGrid对象
    $('#dataGrid').dataGrid({
        searchForm: $("#searchForm"),
        columnModel: [
            {
                header: '执行ID', name: 'executionId', index: '', width: 130, align: "center"
            },
            {header: '流程实例ID', name: 'processInstanceId', index: '', width: 140, align: "center"},
            {header: '流程定义ID', name: 'processDefinitionId', index: '', width: 140, align: "center"},
            {header: '当前环节', name: 'name', index: '', width: 80, align: "center"},
            {
                header: '是否挂起',
                name: 'suspensionState',
                index: '',
                width: 50,
                align: "center",
                formatter: function (val, obj, row, act) {
                    return val == 1 ? "正在运行" : "已挂起";
                }
            },
            {
                header: '操作',
                name: 'actions',
                width: 30,
                sortable: false,
                title: false,
                align: "center",
                formatter: function (val, obj, row, act) {
                    var actions = [];
                <%
                    if (hasPermi('act:process:edit')) { %>

                        actions.push('<a href="${ctx}/act/process/deleteProcIns?procInsId=' + row.processInstanceId + '&reason=" class="btnList" title="删除" data-prompt="输入删除原因并确认："><i class="fa fa-trash-o"></i></a>&nbsp;');

                    <%
                    }
                %>

                    return actions.join('');
                }
            }
        ],
        // 加载成功后执行事件
        ajaxSuccess: function (data) {

        }
    });

</script>
